home *** CD-ROM | disk | FTP | other *** search
/ Magnum One / Magnum One (Mid-American Digital) (Disc Manufacturing).iso / d12 / v7n14.arc / FIG10.TXT < prev    next >
Encoding:
Text File  |  1988-08-06  |  376 b   |  21 lines

  1. struct _tree
  2. {
  3.     char *word;
  4.     int    count;
  5.     struct _tree *left;
  6.     struct _tree *right;
  7. };
  8.  
  9. void treeprint(struct _tree *node)
  10. {
  11.     static int depth = 0;
  12.  
  13.     if(node)
  14.         printf("\nLevel %d: %d occurrences of %s",
  15.             depth,node->count,node->word);
  16.     depth++;
  17.     treeprint(node->left);
  18.     treeprint(node->right);
  19.     depth--;
  20. }
  21.